function love.load()
	map = {}

	key = love.keyboard.isDown

	sprite = {
		love.graphics.newImage("img/block/1.png"),
		love.graphics.newImage("img/block/2.png"),
		love.graphics.newImage("img/block/3.png"),
	}

	size = 1
	block_width = sprite[1]:getWidth() * size
	block_depth = (sprite[1]:getHeight() / 2) * size
	grid_size = #map
	grid_x = 400
	grid_y = 300

	for z = 1, 10 do
		map[z] = {}
		for y = 1, 10 do
			map[z][y] = {}
			for x = 1, 10 do
				if z < 8 then
					map[z][y][x] = 3
				elseif z < 10 then
					map[z][y][x] = 2
				else map[z][y][x] = 1 end
			end
		end
	end
	t = 0
end

function love.update(dt)
	t = t + dt
	if t > 0.1 then t = 0
		map[math.random(1, 10)][math.random(1, 10)][math.random(1, 10)] = math.random(1, 3)
	end

	if key("up") then grid_y = grid_y + dt*1000 end
	if key("down") then grid_y = grid_y - dt*1000 end
	if key ("left") then grid_x = grid_x + dt*1000 end
	if key ("right") then grid_x = grid_x - dt*1000 end

end

function love.draw()
	for z = 1, #map do
		for y = 1, #map do
			for x = 1, #map do
				if map[y][x] ~= 0 then
					--love.graphics.rectangle("fill", (x*8)-8, (y*8)-8, 8, 8)
					love.graphics.draw(sprite[map[z][y][x]],
					grid_x + ((y-x) * (block_width / 2)),
					grid_y-(32*(z)) + ((x+y) * (block_depth / 2)) - (block_depth * (grid_size / 2)), 0, size, size)
				end
			end
		end
	end
end